8c779802a1ad37ab38f1add119a6682a2dac9c33,opennms-provision/opennms-detector-simple/src/main/java/org/opennms/netmgt/provision/detector/snmp/CiscoIpSlaDetector.java,CiscoIpSlaDetector,isServiceDetected,#InetAddress#DetectorMonitor#,105
Before Change
// Iterate over the list of configured IP SLAs
for (SnmpInstId ipslaInstance : tagResults.keySet()) {
log().debug(getServiceName() + " detect: [" + tagResults.get(ipslaInstance).toString() + "] compared with [" + getVbvalue() + "]");
/*
* Check if a configured IP SLA with specific tag exist and the
* the operational state ACTIVE(6), detected with first match.
*/
if (tagResults.get(ipslaInstance).toString().equals(getVbvalue())
&& operStateResults.get(ipslaInstance).toInt() == RTT_MON_OPER_STATE.ACTIVE.value()) {
log().debug(getServiceName()
+ ": admin tag [" + getVbvalue() + "] found and status is "
+ operStateResults.get(ipslaInstance).toInt());
detected = true;
break; // detected leave for()
} else {
log().debug(getServiceName()
+ ": admin tag [" + getVbvalue() + "] found and status is "
+ operStateResults.get(ipslaInstance).toInt());
detected = false; // not detected, check next or return with not detected
}
}
After Change
// Iterate over the list of configured IP SLAs
for (SnmpInstId ipslaInstance : tagResults.keySet()) {
LogUtils.debugf(this, getServiceName() + "%s detect: [%s] compared with [%s]", getServiceName(), tagResults.get(ipslaInstance), getVbvalue());
/*
* Check if a configured IP SLA with specific tag exist and the
* the operational state ACTIVE(6), detected with first match.
*/
if (tagResults.get(ipslaInstance).toString().equals(getVbvalue())
&& operStateResults.get(ipslaInstance).toInt() == RTT_MON_OPER_STATE.ACTIVE.value()) {
LogUtils.debugf(this, "%s: admin tag [%s] found and status is %d", getServiceName(), getVbvalue(), operStateResults.get(ipslaInstance).toInt());
detected = true;
break; // detected leave for()
} else {
LogUtils.debugf(this, "%s: admin tag [%s] not found and status is %d", getServiceName(), getVbvalue(), operStateResults.get(ipslaInstance).toInt());
detected = false; // not detected, check next or return with not detected
}
}
} catch (final NullPointerException e) {
LogUtils.warnf(this, e, "SNMP not available or CISCO-RTT-MON-MIB not supported!");
} catch (final NumberFormatException e) {
LogUtils.warnf(this, e, "Number operator used on a non-number.");
} catch (final IllegalArgumentException e) {
LogUtils.warnf(this, e, "Invalid SNMP criteria.");
} catch (final Throwable t) {
LogUtils.warnf(this, t, "Unexpected exception during SNMP poll of interface %s", address.getHostAddress());
}